<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <button @click="flag=!flag">按钮</button>
        <h2 v-show="flag">welcome</h2>
        <h2 v-if="flag">welcome</h2>
        <hr>

        <h2 v-if="age>60">老年</h2>
        <h2 v-else-if="age>=40">中年</h2>
        <h2 v-else-if="age>=18">少年</h2>
        <h2 v-else>童年</h2>
        <hr>

        <ul>
            <!-- 数组 -->
            <!-- <li v-for="item in nums">{{ item }}</li> -->
            <!-- <li v-for="(item,index) in nums">{{ index }} --- {{ item }}</li> -->

            <!-- 对象 -->
            <li v-for="(item,index) in user" :key="index">{{ index }} --- {{ item }}</li>

            <!-- 数字 -->
            <!-- <li v-for="item in n">{{ item }}</li> -->

        </ul>
    </div>
</body>
<script>
    var vm = new Vue({
        el:'#app',
        data:{ 
            flag:true,
            age:25,
            nums:['aa','bb','cc'],
            user: {
                id:1001,
                username:'lisi',
                age:25,
                sex:'male'
            },
            n: 8
        },
    })
</script>
</html>